<?php

# /app/controllers/recipes_controller.php

class ResourcesController extends AppController {

    //function index() {
    //    
    //}
    function show() {
        $xml = new XMLReader();
        $xml->open("test.xml");
        while($xml->read()){
            echo($xml->name.":".$xml->value."|".$xml->nodeType."<br />");
            echo($xml->readInnerXML()."<br />");
        }
    }

    function search_xml($url) {
        $searched = false;
        $xml = new XMLReader();
        $xml->open($url);
        while ($xml->read()) {
            if ($xml->name == "searched") {
                $searched = true;
            } elseif ($xml->name = resourceitem) {
                if ($searched || search_text) {
                    
                }
            }
        }
    }

    function search_text($text, $keywords) {
        foreach ($keywords as $keyword) {
            if (stripos($text, $keyword)) {
                return true;
            }
        }
        return false;
    }

    function read_resourceitem($xml) {
        while ($xml->name = resourceitem) {
            
        }
        #return "" 
    }

}
?>

